package com.hontech.bv.conn.api

import com.hontech.bv.conn.Proto
import com.hontech.bv.conn.SerialPortMod
import com.hontech.bv.conn.serial.Uint8

object Pick {

    suspend fun init() {
        SerialPortMod.request(
            Proto.REQ_PICK_INIT,
            Proto.ID_PICK,
            arrayOf()
        ).assert("取物门控制板初始化")
    }

    suspend fun doorCtrl(type: Int, value: Int) {
        SerialPortMod.request(
            Proto.REQ_PICK_DOOR_CTRL,
            Proto.ID_PICK,
            arrayOf(Uint8(type), Uint8(value))
        ).assert("取物门测试")
    }

    suspend fun ledCtrl(type: Int, value: Int) {
        SerialPortMod.request(
            Proto.REQ_PICK_LED_CTRL,
            Proto.ID_PICK,
            arrayOf(Uint8(type), Uint8(value))
        ).assert("取物门灯测试")
    }

    suspend fun pick(type: Int) {
        SerialPortMod.request(
            Proto.REQ_PICK_DO,
            Proto.ID_PICK,
            arrayOf(Uint8(type))
        ).assert("取物门出货")
    }

}